﻿using System;

namespace Rosieks.Web.Flow.Internals
{
    internal static class ObjectExtensions
    {
        public static TValue Maybe<TObject, TValue>(this TObject obj, Func<TObject, TValue> value, TValue @default = default(TValue))
        {
            if (obj != null)
            {
                return value(obj);
            }
            else
            {
                return @default;
            }
        }
    }
}
